
function opacityPic(obj, pic, ann) {
    var len = pic.length;
    var now = 0, t = null;

    function opacity(n, oldnow)//2,0
    {
        if (oldnow == -1) {
            pic.eq(len - 1).animate({opacity: 0}, 'slow');
            pic.eq(n).animate({opacity: 1}, 'slow');
            pic.eq(len - 1).removeClass('active');
            ann.eq(len - 1).removeClass('active');
        } else {
            pic.eq(oldnow).animate({opacity: 0}, 'slow');
            pic.eq(n).animate({opacity: 1}, 'slow');
            pic.eq(oldnow).removeClass('active');
            ann.eq(oldnow).removeClass('active');
        }
        pic.eq(n).addClass('active');
        ann.eq(n).addClass('active');

    }

    obj.hover(function () {
        clearInterval(t);
    }, function () {
        t = setInterval(function () {
            now++;
            if (now == len) {
                now = 0
            }
            opacity(now, now - 1);
        }, 3000);
    }).trigger('mouseleave');

    ann.each(function (i) {
        $(this).click(function () {

            if (now != i) {
                opacity(i, now);
            }
            /*console.log(i);//1
            console.log(now);//0*/
            now = i;

        });

    });
}//轮播图切换



